<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8">
		<title>layui</title>
		<meta name="renderer" content="webkit">
		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
		<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
		<link rel="stylesheet" href="../css/layui.css" media="all">
		<!-- 注意：如果你直接复制所有代码到本地，上述css路径需要改成你本地的 -->
	</head>

	<body>
		<!-- 让IE8/9支持媒体查询，从而兼容栅格 -->
		<!--[if lt IE 9]>
  <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
  <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->

		<div class="layui-container">

			<div class="layui-row">

				<fieldset class="layui-elem-field layui-field-title" style="margin-top: 50px;">
					<legend>报告上传</legend>

				</fieldset>

				<div class="layui-table" style="margin-top: 75px;">

					<table class="layui-table" lay-skin="line" style="text-align: center;">
						<colgroup>
							<col width="150">
							
							<col width="400">
							<col>
						</colgroup>
						<thead >
							<tr >
								<th style="text-align: center;">课程名称</th>
								
								<th style="text-align: center;">实验时间</th>
								<th style="text-align: center;">操作</th>
							</tr>
						</thead>
						<tbody>
							<tr>
								<td>贤心</td>
								
								<td>1989-10-14</td>
								<td>
									<button type="button" class="layui-btn" id="test3" ><i class="layui-icon"></i>上传文件</button>
								</td>
							</tr>
							<tr>
								<td>张爱玲</td>
								
								<td>1920-09-30</td>
								<td>
									<button type="button" class="layui-btn" id="test3"><i class="layui-icon"></i>上传文件</button>
								</td>
							</tr>
							<tr>
								<td>Helen Keller</td>
								
								<td>1880-06-27</td>
								<td>
									<button type="button" class="layui-btn" id="test3"><i class="layui-icon"></i>上传文件</button>
								</td>

							</tr>

							<tr>
								<td>孟子</td>
							
								<td>公元前-372年</td>
								<td>
									<button type="button" class="layui-btn" id="test3"><i class="layui-icon"></i>上传文件</button>
								</td>
							</tr>
						</tbody>
					</table>
				</div>

			</div>

		</div>

		<script src="../layui.js" charset="utf-8"></script>
		<!-- 注意：如果你直接复制所有代码到本地，上述js路径需要改成你本地的 -->
		<script>
			
			$.ajax({
					url:"http://localhost:8080/student/nodo.do",
					async:"get",
					dataType:"json",
					data:{
						sid:$.cookie("sid")
					},
					success:function(data){
						if(data.info == "404"){
							window.location.href="stulogin.html";
						}
					}
					
				})
			
			$(document).ready(function() {
				$(document).bind("contextmenu", function(e) {
					return false;
				});
			});
			
			layui.use('upload', function() {
				var $ = layui.jquery,
					upload = layui.upload;

				//指定允许上传的文件类型
				upload.render({
					elem: '#test3',
					url: '/upload/',
					accept: 'file' //普通文件
						,
					size: 60, //限制文件大小，单位KB
					done: function(res) {
						console.log(res)
					}
				});
				

				//同时绑定多个元素，并将属性设定在元素上
				upload.render({
					elem: '.demoMore',
					before: function() {
						layer.tips('接口地址：' + this.url, this.item, {
							tips: 1
						});
					},
					done: function(res, index, upload) {
						var item = this.item;
						console.log(item); //获取当前触发上传的元素，layui 2.1.0 新增
					}
				})

				//选完文件后不自动上传
				upload.render({
					elem: '#test8',
					url: '/upload/',
					auto: false
						//,multiple: true
						,
					bindAction: '#test9',
					done: function(res) {
						console.log(res)
					}
				});

				//拖拽上传
				upload.render({
					elem: '#test10',
					url: '/upload/',
					done: function(res) {
						console.log(res)
					}
				});

			});
		</script>

	</body>

</html>